import 'package:json_annotation/json_annotation.dart';

part 'homepage.g.dart';

@JsonSerializable()
class HomepageArticleModel {
  bool isTop;

  String imgUrl;

  int previewCount;

  String describe;

  String avatar;

  String nickname;

  HomepageArticleModel(
      {this.isTop = false,
      required this.imgUrl,
      required this.previewCount,
      required this.describe,
      required this.avatar,
      required this.nickname});

  factory HomepageArticleModel.fromJson(Map<String, dynamic> json) =>
      _$HomepageArticleModelFromJson(json);

  Map<String, dynamic> toJson() => _$HomepageArticleModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

@JsonSerializable()
class HomepageVideoModel {
  String imgUrl;

  int previewCount;

  String describe;

  String avatar;

  String nickname;

  HomepageVideoModel(
      {required this.imgUrl,
      required this.previewCount,
      required this.describe,
      required this.avatar,
      required this.nickname});

  factory HomepageVideoModel.fromJson(Map<String, dynamic> json) =>
      _$HomepageVideoModelFromJson(json);

  Map<String, dynamic> toJson() => _$HomepageVideoModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}
